<?php
include '../conn.php';
include 't-cookie.php';
?>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的课题-教师端</title>
    <link rel="stylesheet" type="text/css" href="../css/htmleaf-demo.css">
    <link rel="stylesheet" type="text/css" href="../css/nav.css">
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">

    <link rel="stylesheet" href="../css/bootstrap-theme.css"/>

    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script type="text/javascript" src="../js/bootstrap3.0.3.min.js"></script>

    <style>
        #out {
            position: absolute;
            right: 30px;
            top: 20px;
            z-index: 100000;
        }

        .topx {
            margin: 0px;
            padding-top: 50px;
            position: fixed;
            z-index: 999;
            /*浮动部分*/
            /*float:left; */
        }

        .navfont {
            font-family: "黑体";
            font-size: 1.5em;
            padding-top: 10px;
        }

        .indexborder {
            border: 1px transparent;
            border-color: transparent;
            border-color: rgba(0, 0, 0, 0);
            margin-left: 285px;
            margin-right: 5%;
        }

        .bodycolor {
            background-color: gainsboro;
        }

        .box-inline {
            box-shadow: 0px 2px 2px grey;
        }

        .indexdiv1 {
            margin-top: 70px;
            margin-bottom: 20px;
            /*margin-left: 0px;*/
            padding: 2% 2% 2% 2%;
            width: 100%;
            /*height:400px;*/
        }

        .navbackground-t {
            background-color: #003300;
        }

        .indexfooter {
            background-color: dimgray;
            /*height: 50px;*/
            position: absolute;
            bottom: 0px;
            width: 100%;
        }

        .footer-p {
            padding-top: 10px;
            padding-left: 210px;
        }

        .paneldiv {
            margin-left: 40px;
        }

        .black_overlay {
            /*  弹窗样式*/
            display: none;
            position: absolute;
            top: 0%;
            left: 0%;
            width: 100%;
            height: 100%;
            background-color: black;
            z-index: 1001;
            -moz-opacity: 0.6;
            opacity: .60;
            filter: alpha(opacity=80);
        }

        .white_content {
            display: none;
            position: absolute;
            top: 10%;
            left: 10%;
            width: 80%;
            height: 80%;
            border: 16px solid lightblue;
            background-color: white;
            z-index: 1002;
            overflow: auto;
        }

        .white_content_small {
            display: none;
            position: absolute;
            top: 40%;
            left: 30%;
            width: 40%;
            height: 50%;
            border: 16px solid lightblue;
            background-color: white;
            z-index: 1002;
            overflow: auto;
        }

        .top1 {
            margin-top: 70px;
        }

        @media screen and (max-width: 900px) {
            #nav {
                width: 25%;
                font-size: 0.8em;
            }

            #news {
                width: 100%;
                font-size: 70%;
            }

            .paneldiv {
                width: 100%;
                font-size: 90%;
            }

            .indexborder {
                margin-left: 35%;
                margin-right: 5%;
            }

            .footer-p {
                padding-left: 26%;
            }
        }

        @media screen and (max-width: 400px) {
            #nav {
                width: 25%;
                font-size: 0.5em;
            }

            .navfont {
                font-size: 1em;
            }

            #news {
                width: 100%;
                font-size: 60%;
            }

            .paneldiv {
                width: 100%;
                font-size: 65%;
            }

            .indexborder {
                margin-left: 35%;
                margin-right: 5%;
            }

            .footer-p {
                padding-left: 26%;
            }
        }

        @media screen and  (max-width: 900px) {
            table thead {
                display: none;
            }

            table td {
                display: block;
                text-align: right;
                font-size: 13px;
                border-bottom: 1px dotted #ccc;
            }

            table tr {
                margin-bottom: 10px;
                display: block;
                border-bottom: 2px solid #ddd;
            }

            table td:before {
                content: attr(data-label);
                float: left;
                text-transform: uppercase;
                font-weight: bold;
            }
        }
    </style>
    <script type="text/javascript">
        function changekt(t) {
            window.open('t-subjectChage.php?type=change&id=' + t, '_self');
        }
        function newkt() {
            window.open("t-subjectNew.html", '_self');
        }

    </script>

</head>

<body class="bodycolor">

<nav class="navbar navbar-default navbar-fixed-top" style="clear: left;">
    <div class="container">
        <div class="navbar-right navfont" id="navbar-collapse">
            <p>华软网络技术系毕业管理系统</p>
        </div>
        <a href="t-cookie.php?cookie=out" id="out">退出</a>
    </div>

</nav>

<div class="nav topx navbackground-t" id="nav">
    <div>

        <div style="border-bottom:1px solid rgba(255,255,255,.1)"><img src="../images/mini.png"></div>
    </div>
    <ul>
        <li class="nav-item">
            <a href="t-index.php"><i class="my-icon nav-icon icon_2"></i><span>首页</span><i class="my-icon nav-more"></i></a>

        </li>
        <li class="nav-item">
            <a href="t-mykt.php"><i class="my-icon nav-icon icon_1"></i><span>我的课题</span><i
                    class="my-icon nav-more"></i></a>
        </li>
        <li class="nav-item">
            <a href="t-checkproject.php"><i class="my-icon nav-icon icon_6"></i><span>选课核查</span><i
                    class="my-icon nav-more"></i></a>
        </li>
        <li class="nav-item">
            <a href="#"><i class="my-icon nav-icon icon_3"></i><span>评分评语</span><i class="my-icon nav-more"></i></a>
            <ul>
                <li>
                    <a href="t-GuideMark.php"><span>指导评分</span></a>
                </li>
                <li>
                    <a href="t-ThesisMark.php"><span>论文评分</span></a>
                </li>
                <li>
                    <a href="t-ReplyMark.php"><span>答辩评分</span></a>
                </li>
            </ul>
        </li>
        <li class="nav-item">
            <a href="t-all.php"><i class="my-icon nav-icon icon_6"></i><span>答辩汇总</span><i
                    class="my-icon nav-more"></i></a>

        </li>
        <li class="nav-item">
            <a href="#"><i class="my-icon nav-icon icon_3"></i><span>资料管理</span><i class="my-icon nav-more"></i></a>
            <ul>
                <li>
                    <a href="t-information.php"><span>我的资料</span></a>
                </li>
                <li>
                    <a href="t-mystudent.php"><span>我的学生</span></a>
                </li>

            </ul>
        </li>
    </ul>
</div>

<div class="indexborder top1">
    <div class="tablediv">

        <div width="100%">
            <div>
                <!-- style="margin-left: 70px;"-->
                <div class="box-inline indexdiv2 panel panel-default auto" align="center">
                    <div class="panel panel-primary panel-success">
                        <div class="panel-heading" style="padding: 0px;color: black;font-style:initial;">
                            <h3 class="panel-title " style="background-color: #8FBC8F;padding: 15px;">全部课题</h3>
                        </div>
                        <div class="panel-body">
                            <div class="table-responsive">

                                <table class="table  table-hover  table-striped">

                                    <div id="fade" class="black_overlay">
                                        <!--//弹窗-->
                                    </div>
                                    <div id="MyDiv" class="white_content_small">
                                        <div style="text-align: right; cursor: default; height: 40px;">
                                            <span style="font-size: 16px;" onclick="CloseDiv('MyDiv','fade')">关闭</span>
                                        </div>

                                        <form action="t-subjectTask.php" method="post" enctype="multipart/form-data">
                                            <input type="text" name="projectid" id="projectid"/>

                                            <h3>任务书</h3>
                                            <input type="file" name="upassfile" size="15">
                                            <input type="submit" name="asstask" value="" id="task"/>
                                            <a href="" id="taskhrf"></a>

                                            <h3>答辩稿</h3>
                                            <input type="file" name="uptaskfile" size="15">
                                            <input type="submit" name="draft" value="" id="draft"/ >
                                            <a href="" id="drafthrf"></a>
                                        </form>

                                    </div>

                                    <thead>
                                    <tr class="thcolor">

                                        <th>课题名称</th>
                                        <th>类别</th>
                                        <th>来源</th>
                                        <th>指导教师</th>
                                        <th>学生</th>

                                        <th>任务书</th>
                                        <th>答辩稿</th>
                                        <th>成绩单</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <form action="t-subjectChage.php" method="get">
                                        <?php

                                        $sql = "SELECT p.ProjectName, p.Category, p.ProjectOrigin, t.TeacherName,
s.StudentName,p.ProjectId,s.StudentId

				FROM project AS p

				JOIN teacher AS t ON p.Teacher_TeacherId =
t.TeacherId
                JOIN student as s on p.Student_StudentId=s.StudentId
				WHERE t.TeacherId=" . $_SESSION["t-id"] . " and
p.Year=" . $_SESSION["t-Year"];
                                        $result = mysqli_query($conn, $sql);


                                        while ($row = mysqli_fetch_array($result)) {
                                            ?>

                                            <tr>


                                                <td data-label="课题名称"><?= $row[0] ?></td>

                                                <td data-label="类别"><?= $row[1] ?></td>

                                                <td data-label="来源"><?= $row[2] ?></td>

                                                <td data-label="指导教师"><?= $row[3] ?></td>

                                                <td data-label="学生"><?= $row[4] ?></td>


                                                <td data-label="任务书">
                                                    <?$Asql = "select Assignment from project WHERE ProjectId=$row[5]";
                                                    $Aresult = $conn->query($Asql);
                                                    $Arow = $Aresult->fetch_array();
                                                    $Dsql = "select Draft from project WHERE ProjectId=$row[5]";
                                                    $Dresult = $conn->query($Dsql);
                                                    $Drow = $Dresult->fetch_array();
                                                    ?>
                                                    <a onclick="ShowDiv('MyDiv','fade',<?= $row[5] ?>,'<?= $Arow[0] ?>','<?= $Drow[0] ?>')">任务书</a>

                                                </td>

                                                <td data-label="答辩稿">
                                                    <a onclick="ShowDiv('MyDiv','fade',<?= $row[5] ?>,'<?= $Arow[0] ?>','<?= $Drow[0] ?>')">答辩稿</a>


                                                </td>

                                                <td data-label="成绩单">

                                                    <a onclick="examination(<?=$row[6]?>)">成绩单</a>

                                                </td>

                                                <td data-label="操作"><input type="button" value="编辑"
                                                                           onclick="changekt(<?= $row[5] ?>)"></td>

                                            </tr>

                                        <?
                                        }
                                        $sql = "SELECT p.ProjectName, p.Category, p.ProjectOrigin, t.TeacherName,
p.ProjectId,p.Student_StudentId
				FROM project AS p
				JOIN teacher AS t ON p.Teacher_TeacherId =
t.TeacherId
				WHERE t.TeacherId=" . $_SESSION["t-id"] . " and
p.Year=" . $_SESSION["t-Year"];
                                        $result = mysqli_query($conn, $sql);


                                        while ($row = mysqli_fetch_array($result)) {
                                            if (!$row[5]) {
                                                ?>

                                                <tr>


                                                    <td data-label="课题名称"><?= $row[0] ?></td>

                                                    <td data-label="类别"><?= $row[1] ?></td>

                                                    <td data-label="来源"><?= $row[2] ?></td>

                                                    <td data-label="指导教师"><?= $row[3] ?></td>

                                                    <td data-label="学生"></td>


                                                    <td data-label="任务书">

                                                        <a>任务书</a>

                                                    </td>

                                                    <td data-label="答辩稿">

                                                        <a>答辩稿</a>

                                                    </td>

                                                    <td data-label="成绩单">

                                                        <a>成绩单</a>

                                                    </td>

                                                    <td data-label="操作"><input type="button" value="编辑"
                                                                               onclick="changekt(<?= $row[4] ?>)"></td>

                                                </tr>

                                            <?
                                            }
                                        }
                                        ?>

                                    </form>
                                    </tbody>
                                </table>

                                <div style="margin-top: 10px;">

                                    <div style="float: right;margin-right: 20px;"><input type="button" value="添加"
                                                                                         class="btn btn-success "
                                                                                         onclick="newkt()"></div>

                                </div>
                            </div>
                        </div>
                    </div>

                </div>
                </center>
                </td>

                </tr>


                </tbody>
                </table>
            </div>
        </div>
    </div>
</div>

<!--<footer class="indexfooter container-fluid  bottom">
    <p class="footer-p" align="center">地址：广东省广州市从化区经济开发区高技术产业园广从南路548号 | 电话：020－87818918 邮编：510990 | 网站公安备案编号：4401840100050 粤ICP备：05085382号 站长统计</p>
</footer>-->

<script>
    window.jQuery || document.write('<script src="../js/jquery-1.11.0.min.js"><\/script>')
</script>
<script type="text/javascript" src="../js/nav.js"></script>

<script type="text/javascript">
    //弹窗实现
    //弹出隐藏层
    function ShowDiv(show_div, bg_div, id, asspath, draftpath) {
        document.getElementById('projectid').value = id;
        if (asspath != "") {
            document.getElementById('task').value = '更新';
            document.getElementById('taskhrf').href = asspath;
            document.getElementById('taskhrf').innerText = '下载';
        } else {
            document.getElementById('task').value = '上传任务书';
            document.getElementById('taskhrf').href = '';
            document.getElementById('taskhrf').innerText = '';
        }
        if (draftpath != "") {
            document.getElementById('draft').value = '更新';
            document.getElementById('drafthrf').href = draftpath;
            document.getElementById('drafthrf').innerText = '下载';
        } else {
            document.getElementById('draft').value = '上传答辩稿';
            document.getElementById('drafthrf').href = '';
            document.getElementById('drafthrf').innerText = '';
        }

        document.getElementById(show_div).style.display = 'block';
        document.getElementById(bg_div).style.display = 'block';
        var bgdiv = document.getElementById(bg_div);
        bgdiv.style.width = document.body.Width;
        // bgdiv.style.height = $(document).height();
        $("#" + bg_div).height($(document).height());
    }
    ;
    //关闭弹出层
    function CloseDiv(show_div, bg_div) {
        document.getElementById(show_div).style.display = 'none';
        document.getElementById(bg_div).style.display = 'none';
    }
    ;
</script>
<script type="text/javascript">
    function examination(id){
        var path = "examination.php?sid=" + id;
        alert(path);

        layer.open({
            type: 1,
            area: ['80%', '80%'],
            shadeClose: true, //点击遮罩关闭
            content: "<iframe src=''  width='98%' height='94%' name=main frameborder= scrolling=NO id='testFrame'></iframe>"
        });
        var t = document.getElementById("testFrame");
        t.src = path;
    }
    </script>
    <script type="text/javascript" src="../js/nav.js"></script>
    <script type="text/javascript" src="../layer/layer.js"></script>
</body>

</html>